package com.zhn.evsi.controller.Evsi;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zhn.evsi.client.SystemClient;
import com.zhn.evsi.common.Result;
import com.zhn.evsi.domain.dto.evsi.EvsiSystemStatusDTO;
import com.zhn.evsi.service.IEvsiSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "EVSI设置项")
@RequestMapping("/Evsi/system")
@RestController
public class EvsiSystemController {

    @Resource
    private SystemClient systemClient;
    @Autowired
    private IEvsiSystemService systemService;

    /**
     * 获取服务器当前状态
     * */
    @ApiOperation("获取服务器当前状态值")
    @GetMapping("/status")
    public Result status() {
        JSONObject status = systemClient.status();
        EvsiSystemStatusDTO evsiSystemStatusDTO = JSON.toJavaObject(status, EvsiSystemStatusDTO.class);
        return Result.success(evsiSystemStatusDTO);
    }

    /**
     * 设置金额数量
     * */
    @ApiOperation("设置钱包可视参数")
    @GetMapping("/walletSize")
    public Result walletSize(@RequestParam Integer num) {
        systemService.walletSize(num);
        return Result.success();
    }
}
